package com.paiai.lslease.dao.apphouse;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.paiai.lslease.auto.model.AppLock;
import com.paiai.lslease.model.AppLockTenantInfo;

import java.sql.SQLException;
import java.util.List;

public class AppLockTenantInfoDAOImpl implements AppLockTenantInfoDAO {

    private SqlMapClient sqlMapClient;

    public AppLockTenantInfoDAOImpl(SqlMapClient sqlMapClient) {
        super();
        this.sqlMapClient = sqlMapClient;
    }

    public int selectNeweastAppLockTenantId() throws SQLException {
        return (Integer) sqlMapClient.queryForObject("app_lock_tenant_info.selectNeweastAppLockTenantId");
    }

    public List<AppLock> selectAllLockByTenantId(int tenantId) throws SQLException {
        return sqlMapClient.queryForList("app_lock_tenant_info.selectAllLocByTenantId", tenantId);
    }

    @Override
    public List<AppLockTenantInfo> selectAllLockTenantInfoByLockId(String lockId) throws SQLException {
        return sqlMapClient.queryForList("app_lock_tenant_info.selectAllLockTenantByLockId", lockId);
    }
}
